package common;

import java.util.Properties;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

public class LogCategory {

	public static Logger root;

	static {
		root = Logger.getRootLogger();
		reloadProperties();
	}

	/**
	 * Reloads properties
	 * 
	 * @exception RuntimeException
	 *                Description of Exception
	 */
	public static synchronized void reloadProperties() {
		Configuration config = new Configuration("log4jproperties", "log4j.properties");
		Properties logProperties = config.getProperties();
		PropertyConfigurator.configure(logProperties);
	}

	/**
	 * Gets the Category attribute of the LogCategory name
	 * 
	 * @param name a name
	 * @return The Category value
	 */
	public static Logger getCategory(String name) {
		Logger c = Logger.getLogger(name);
		return (c);
	}

	/**
	 * Gets the Category attribute of the LogCategory class
	 * 
	 * @param class a class
	 * @return The Category value
	 */
	public static Logger getCategory(Class<?> clazz) {
		Logger c = Logger.getLogger(clazz.getName());
		return (c);
	}
}
